<?php
/**
 * xysc users Version1.0
 * ==================================
 * Copy 2016-2017
 * Web:www.xjh7.com
 * ==================================
 * Author:xjh
 * Date:2016-2-23
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>轩辕商城</title>
<link rel="stylesheet"  href="<?php echo backweb_CSS_URL;?>bootstrap.min.css" /> 
<script type="text/javascript" src="<?php echo JS_URL; ?>jquery.js"></script>
<script type="text/javascript" src="<?php echo JS_URL; ?>index.js"></script>
   <script src="<?php echo backweb_JS_URL;?>jquery-1.9.1.min.js"></script>
   <script src="<?php echo backweb_JS_URL;?>bootstrap.min.js"></script>
<script>

//浏览器判断http://127.0.0.1/xysc/xysc/index.php
function myBrowser(){
    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
    var isOpera = userAgent.indexOf("Opera") > -1; //判断是否Opera浏览器
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
    var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
    var isSafari = userAgent.indexOf("Safari") > -1; //判断是否Safari浏览器

    var isChrome = window.navigator.userAgent.indexOf("Chrome") !== -1;
    if (isIE) {
        window.location.href="404.php";
        var IE5 = IE55 = IE6 = IE7 = IE8 = false;
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var fIEVersion = parseFloat(RegExp["$1"]);
        IE55 = fIEVersion == 5.5;
        IE6 = fIEVersion == 6.0;
        IE7 = fIEVersion == 7.0;
        IE8 = fIEVersion == 8.0;
        if (IE55) {
            return "IE55";
        }
        if (IE6) {
            return "IE6";
        }
        if (IE7) {
            return "IE7";
        }
        if (IE8) {
            return "IE8";
        }
    }//isIE end
    if (isFF) {
        return "FF";
    }
    if (isOpera) {
        return "Opera";
    }
    if(isChrome){
		return "Chrome";
    }
}//myBrowser() end
//以下是调用上面的函数
if (myBrowser() == "FF") {
   // alert("我是 Firefox");
}
if (myBrowser() == "Opera") {
   // alert("我是 Opera");
}
if (myBrowser() == "Safari") {
    //alert("我是 Safari");
}
if (myBrowser() == "IE55") {
//    alert("我是 IE5.5");
}
if (myBrowser() == "IE6") {
//    alert("我是 IE6");
}
if (myBrowser() == "IE7") {
//    alert("我是 IE7");
}
if (myBrowser() == "IE8") {
//    alert("我是 IE8");
}
if(myBrowser() == "Chrome"){
//	alert("我是Chrome");
}

myBrowser();




$(function (){


	$("#divTip").animate({
		width:'100%'
	}, 2000).animate({
		height:'0%'
	}, 1000);

	$("#test1").click(function (){
		localStorage.setItem("b","Hello World!");
	});
	$("#test2").click(function (){
		localStorage.removeItem("b");
	});
	var b = localStorage.getItem("b");
	
	
	var timeid;
	var img = $("#progressImgage");
	$(".nav_hover").mouseover(function (){
		
		var id = $(this).attr("id");
		if(localStorage.getItem("info["+id+"]") != null){
			$(".add[id="+id+"]").html(localStorage.getItem("info["+id+"]")); 
		}else{
		$(".add").html('正在加载数据...');
		timeid = setTimeout(function(){
		$.ajax({
			url:"./index.php?r=backweb/nav/getChildNav&nav_id="+id,
			type:'post',
			beforeSend:function(xhr){

				img.show().css({ 
					"position": "fixed", 
					"top": "40%",
					"left": "45%", 
					"margin-top": function () { return -1 * img.height() / 2; }, 
					"margin-left": function () { return -1 * img.width() / 2; } 
				}); 
				}, 
			success:function (data){
				$(".add[id="+id+"]").html(data); 
				localStorage.setItem("info["+id+"]",data);
			},
			error:function (){
				$(".add[id="+id+"]").html("找不到！！！"); 
			},
			complete:function(xhr){ 
				img.hide(); 
			} 
		});		
		},300);
		
		}
	}).mouseout(function (){
		img.hide(); 
		clearTimeout(timeid);
	});
	localStorage.clear();



	
});
</script>

<style>
.flexslider {
	margin: 0px auto 20px;
	position: relative;
	width: 100%;
	height: 482px;
	overflow: hidden;
	zoom: 1;
}

.flexslider .slides li {
	width: 100%;
	height: 100%;
}

.flex-direction-nav a {
	width: 70px;
	height: 70px;
	line-height: 99em;
	overflow: hidden;
	margin: -35px 0 0;
	display: block;
	background: url(<?php echo IMG_URL;?>ad_ctr.png) no-repeat;
	position: absolute;
	top: 50%;
	z-index: 10;
	cursor: pointer;
	opacity: 0;
	filter: alpha(opacity=0);
	-webkit-transition: all .3s ease;
	border-radius: 35px;
}

.flex-direction-nav .flex-next {
	background-position: 0 -70px;
	right: 0;
}

.flex-direction-nav .flex-prev {
	left: 0;
}

.flexslider:hover .flex-next {
	opacity: 0.8;
	filter: alpha(opacity=25);
}

.flexslider:hover .flex-prev {
	opacity: 0.8;
	filter: alpha(opacity=25);
}

.flexslider:hover .flex-next:hover,
.flexslider:hover .flex-prev:hover {
	opacity: 1;
	filter: alpha(opacity=50);
}

.flex-control-nav {
	width: 100%;
	position: absolute;
	bottom: 10px;
	text-align: center;
}

.flex-control-nav li {
	margin: 0 2px;
	display: inline-block;
	zoom: 1;
	*display: inline;
}

.flex-control-paging li a {
	background: url(<?php echo IMG_URL;?>dot.png) no-repeat 0 -16px;
	display: block;
	height: 16px;
	overflow: hidden;
	text-indent: -99em;
	width: 16px;
	cursor: pointer;
}

.flex-control-paging li a.flex-active,
.flex-control-paging li.active a {
	background-position: 0 0;
}

.flexslider .slides a img {
	width: 100%;
	height: 500px;
	display: block;
}
</style>
</head>
<body >
<form action="./index.php?r=goods/category" method="post">
  <div>
		<div id="header">
			<div id="h_info">
				<div id="left"><img src="<?php echo IMG_URL;?>xy.png" alt="轩辕" title="轩辕商城" /></div>
				<div id="search">
				<dl>
					<dt>
					<dd><input type="text" name="search" placeholder="请输入关键字进行搜索" class="search" />
					<input type="submit" name="send" value="搜索" class="submit" /></dd>
					<dd id="dd">
						<?php for ($i = 0; $i < count($tag_info)-1; $i++) {?>
						<a href="<?php echo $tag_info[$i]['tag_url'];?>"><span <?php if($i % 2== 0) echo  'class="red"';?>><?php echo $tag_info[$i]['tag_name'];?></span></a>|
						<?php }?>
						<a href="<?php echo $tag_info[count($tag_info)-1]['tag_url'];?>"><span class="red"><?php echo $tag_info[count($tag_info)-1]['tag_name'];?></span></a>
					</dd>
					</dt>
				</dl>
				</div>
			</div>
			<div id="menu">
				<ul>
					<?php for ($i = 0; $i < count($nav_info)-1; $i++) {?>
					<li ><a href="<?php echo $nav_info[$i]['nav_url']?>"><?php echo $nav_info[$i]['nav_name']?></a>&nbsp;&nbsp;&nbsp;/</li>
					<?php }?>
					<li><a href="<?php echo $nav_info[count($nav_info)-1]['nav_url']?>"><?php echo $nav_info[count($nav_info)-1]['nav_name']?></a></li>
				</ul>
			</div>
		</div>
		<div id="turn" >
		<div style="height:0px">
			 <div id="banner_tabs" class="flexslider">
		<ul class="slides" style="z-index:99999;">
			<?php foreach ($turn_infos as $_v){?>
				<li>
					<a title=""  href="">
						<img  style="background: url(<?php echo $_v['turn_url'];?>) no-repeat center;" src="<?php echo IMG_URL;?>alpha.png">
					</a>
				</li>
			<?php }?>
		</ul>
		<ul class="flex-direction-nav">
			<li><a class="flex-prev" href="javascript:;">Previous</a></li>
			<li><a class="flex-next" href="javascript:;">Next</a></li>
		</ul>
		<ol id="bannerCtrl" class="flex-control-nav flex-control-paging">
			<?php foreach ($turn_infos as $_k => $_v){?>
			<li <?php if($_k == 0) echo 'class="active"';?>><a><?php echo $_k;?></a></li>
			<?php }?>
		</ol>
		</div>
		</div>
		
				<div id="sidebar"  style="position:relative" >
					<ul style="width: 120px;" >
						<?php for ($i = 0; $i <count($nav_side); $i++) {?>
									<li class="nav_hover"  id="<?php echo $nav_side[$i]['nav_id'];?>">　　<a href="./index.php?r=goods/category&kkeyword=<?php echo $nav_side[$i]['nav_name']?>"><?php echo $nav_side[$i]['nav_name']?></a></li>
						<?php }?>
					</ul>
					<img width="600"  src="<?php echo IMG_URL;?>ajax-loader111.gif" id="progressImgage"   style="display:none;position:relative;left:500px;z-index:9999;filter:" />
				</div>
				<?php for ($i = 0; $i <count($nav_side); $i++) {?>
					<div class="add" id="<?php echo $nav_side[$i]['nav_id'];?>"  style="z-index:8999;"></div>
				<?php }?>
		</div>
		<div id="content" >
		<div id="last" >
			<h2 >新品上市</h2>
			<div id="left"><a href="<?php echo $last_adver[0]['adver_url'];?>"><img width="372" height="270" src="<?php echo $last_adver[0]['adver_thumbnail_url'];?>" title="<?php echo $last_adver[0]['adver_name'];?>" /></a></div>
			<div id="right">
				<dl>
					<dt>
						<?php foreach($last_adverList as $_v){?>
						<dd><a href="<?php echo $_v['adver_url'];?>"><img title="<?php echo $_v['adver_name']?>" width="287" height="150" src="<?php echo $_v['adver_thumbnail_url'];?>" /></a></dd>
						<?php }?>
					</dt>
				</dl>
			</div>
		</div>
		<div id="hot">
			<h2>热门品牌</h2>
			<div id="left"><a href="<?php echo $brand_hot[0]['brand_url'];?>"><img  src="<?php echo $brand_hot[0]['brand_thumbnail_url'];?>" title="<?php echo $brand_hot[0]['brand_name']; ?>" alt="<?php echo $brand_hot[0]['brand_name']; ?>" /></a></div>
			<div id="right" >
				<dl>
					<dt>
						<?php foreach ($brand_info as $_v){?>
						<dd><a href="<?php echo $_v['brand_url']?>"><img width="140" height="80" src="<?php echo $_v['brand_thumbnail_url']?>" alt="<?php echo $_v['brand_name']?>" /></a></dd>
						<?php }?>
					</dt>
				</dl>
			</div>
		</div>
		<div id="adver">
			<a href="<?php echo $hor_adverlist['adver_url'];?>"><img title="<?php echo $hor_adverlist['adver_name'];?>" src="<?php echo $hor_adverlist['adver_thumbnail_url']?>" /></a>
		</div>
		<div id="brand">
			<h2>品牌汇总</h2>
			<div id="up">
			<?php foreach($brand_adverlist as $_v){?>
				<a href="<?php echo $_v['adver_url'];?>"><img  src="<?php echo $_v['adver_thumbnail_url'];?>" alt="<?php echo $_v['adver_name'];?>" title="<?php echo $_v['adver_name'];?>" /></a>
			<?php }?>
			</div>
			<div id="down">
				<?php for ($i = 1; $i <= 4; $i++) {?>
					<dl id="dl<?php echo $i;?>">
							<?php 
								$cccmodel = new CCCModel();
								$adver_brand_list = $cccmodel -> sel("SELECT * FROM {{adverbrand}} WHERE active = 1 AND adverbrand_position=$i ORDER BY adverbrand_sort ASC LIMIT 0,3");	
							?>
					<?php  foreach ($adver_brand_list as $_v){?>
					<dt><a href="<?php echo $_v['adverbrand_url'];?>"><img src="<?php echo $_v['adverbrand_thumbnail_url'];?>" /></a></dt>
					<dd><a href="<?php echo $_v['adverbrand_url'];?>"><p style="color:#666;font-size:18px;"><?php echo $_v['adverbrand_title'];?></p><p style="color:#ccc;font-size:16px;"><?php echo $_v['adverbrand_name'];?></p></a></dd>
				<?php }?>
					</dl>
				<?php }?>
			</div>
		</div>
		<div id="guess" style="clear:both">
			<h2 style="color:#333">-----猜你喜欢-----</h2>
			<table>
			<?php if(!empty($record)){ ?>
			<?php $i = 0; foreach ($record as $_v){?>
			<?php $i++; if($i % 6 == 0) echo '<tr>';?>
				<td>
					<a href="./index.php?r=goods/details&_goods_id=<?php echo $_v['goods_id'];?>">
						<img  width="226" height="226" src="<?php echo $_v['goods_thumbnail_url'];?>" />
						<p><?php echo $_v['goods_name'];?></p>
						<span class="red">¥<?php echo $_v['goods_price'];?></span>
					</a>
				</td>
			<?php }?>
			
			<?php }else{?>
			<?php echo "没有浏览记录";?>
			<?php }?>
			</table>
			<h3>END</h3>
			<h3>该站已经被戳<em style="color:red;font-style:normal;font-size:1em;"><?php echo $counts_nums;?></em>下了</h3>
		</div>
		
	</div>	
	<?php include("guide.php"); ?>
	<script src="<?php echo JS_URL; ?>jquery.js"></script>
	<script src="<?php echo JS_URL; ?>slider.js"></script>
	<script type="text/javascript">
	$(function() {
		var bannerSlider = new Slider($('#banner_tabs'), {
			time: 5000,
			delay: 400,
			event: 'hover',
			auto: true,
			mode: 'fade',
			controller: $('#bannerCtrl'),
			activeControllerCls: 'active'
		});
		$('#banner_tabs .flex-prev').click(function() {
			bannerSlider.prev()
		});
		$('#banner_tabs .flex-next').click(function() {
			bannerSlider.next()
		});
	})
</script>
</body>
</form>
</html>